<template>
  <HomePanel title="热门品牌" sub-title="新鲜出炉 品质靠谱">
    <template #right>
      <XtxMore></XtxMore>
    </template>
    <template #default>
      <ul ref="pannel" class="goods-list">
        <li v-for="item in brandList" :key="item">
          <RouterLink to="/">
            <img v-imgLazy="item.picture" alt="" />
            <p class="name">{{item.name}}</p>
            <p class="price">&yen;{{item.price}}</p>
          </RouterLink>
        </li>
      </ul>
    </template>
  </HomePanel>
</template>

<script>
import { findHomeBrand } from '@/api/home'
import HomePanel from './home-panel'
import { ref } from 'vue'
export default {
  components: { HomePanel },
  setup () {
    const brandList = ref([])
    // 获取 首页-热门品牌
    findHomeBrand().then(({ result }) => {
      brandList.value = result
    })
    return { brandList }
  }
}
</script>

<style scoped lang='less'>
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding-top: 12px;
      text-align: center;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
